<%--
  Created by IntelliJ IDEA.
  User: HI
  Date: 2024/4/26
  Time: 1:05
  To change this template use File | Settings | File Templates.
--%>
<%--
  Created by IntelliJ IDEA.
  User: HI
  Date: 2024/4/24
  Time: 23:17
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@page import="beans.*"%>
<%@page import="java.util.List" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
</head>
<body>
<h1 align="center">欢迎登录书籍查询界面</h1><br>
    <!-- 以下HTML代码段用于显示查询出来的数据 -->
    <form action="find.jsp" method="post">
        搜索：
        <input type="text" name="word">
        <input type="hidden" name="ok" value="1">
        <button type="submit" name="action" id="b" value="b">搜一下</button>
    </form>
     <%
         List <Book> list=(List<Book>)request.getAttribute("books");
%>
        <table border="1">
            <tr>
                <td>编号</td><td>name</td><td>press</td><td>author</td><td>price</td>
                <td>修改</td><td>删除</td>
            <tr/>
            <%
                if(list!=null){
                    for(int i=0;i<list.size();i++){
            %>
            <tr>
                <td><%=list.get(i).getBook_id()%></td><td><%=list.get(i).getBook_name() %></td>
                <td><%=list.get(i).getBook_press() %></td><td><%=list.get(i).getBook_author() %></td>
                <td><%=list.get(i).getBook_price() %></td>

                <%String editURL="BookSevrice?action=toEdit&name="+list.get(i).getBook_name(); %>
                <td><a href=<%=editURL %>>修改</a></td>
                <%String deleteURL="BookSevrice?action=toDel&name="+list.get(i).getBook_name(); %>
                <td><a href=<%=deleteURL %>>删除</a></td>
            </tr>
            <%  }
                System.out.println(list.size());
            }//对应以上的for语句
            %>
        </table>

<form action="/BOOK_war_exploded/Book" method="post">
    <button type="submit" name="action" id="b1" value="确认">返回</button>
</form>
</body>
</html>

